package net.sf.xoperator.ui.txt;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

import net.sf.xoperator.blackboard.NoPlanBlackBoardControl;
import net.sf.xoperator.rdfxmpp.SPARQLQuery;

public class QueryCommand extends Command {

	@Override
	public String getKeyWord() {
		return "query";
	}

	@Override
	public List<Object> performInternal(String call, NoPlanBlackBoardControl control, Interactor interactor) {
		//strip the keyword away 
		SPARQLQuery query = new SPARQLQuery(call.substring(getKeyWord().length()+1));
      List<Object> returnset = new ArrayList<Object>();
      returnset.add(query);
		return returnset;
	}

   @Override
   public String getHelp() {
      return " executes a simple query. for example: 'query select distinct....' ";
   }
   

	@Override
	public Pattern getValidationPattern() {

		return Pattern.compile(".*");
	}

}
